#!/bin/bash
[ -f /proc/sys/fs/file-max ] && echo  1620724 > /proc/sys/fs/file-max
[ -f /proc/sys/net/ipv4/netfilter/ip_conntrack_max ] && echo 1048576 > /proc/sys/net/ipv4/netfilter/ip_conntrack_max
[ -f /proc/sys/net/ipv4/neigh/default/gc_stale_time ] && echo 120 > /proc/sys/net/ipv4/neigh/default/gc_stale_time
[ -f /proc/sys/net/ipv4/neigh/default/gc_thresh1 ] && echo 1024 > /proc/sys/net/ipv4/neigh/default/gc_thresh1
[ -f /proc/sys/net/ipv4/neigh/default/gc_thresh2 ] && echo 4096 > /proc/sys/net/ipv4/neigh/default/gc_thresh2
[ -f /proc/sys/net/ipv4/neigh/default/gc_thresh3 ] && echo 8192 > /proc/sys/net/ipv4/neigh/default/gc_thresh3
[ -f /proc/sys/net/ipv4/tcp_syncookies ] && echo 1 > /proc/sys/net/ipv4/tcp_syncookies
[ -f /proc/sys/net/ipv4/tcp_max_syn_backlog ] && echo 16384 > /proc/sys/net/ipv4/tcp_max_syn_backlog
[ -f /proc/sys/net/core/netdev_max_backlog ] && echo 16384 > /proc/sys/net/core/netdev_max_backlog
[ -f /proc/sys/net/ipv4/tcp_tw_recycle ] && echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle
[ -f /proc/sys/net/ipv4/tcp_tw_reuse ] && echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse
[ -f /proc/sys/net/ipv4/tcp_fin_timeout ] && echo 16 > /proc/sys/net/ipv4/tcp_fin_timeout
[ -f /proc/sys/net/ipv4/tcp_keepalive_time ] && echo 600 > /proc/sys/net/ipv4/tcp_keepalive_time
[ -f /proc/sys/net/ipv4/tcp_syn_retries ] && echo 3 > /proc/sys/net/ipv4/tcp_syn_retries
[ -f /proc/sys/net/ipv4/tcp_synack_retries ] && echo 3 > /proc/sys/net/ipv4/tcp_synack_retries
[ -f /proc/sys/net/core/rmem_default ] && echo 262144 > /proc/sys/net/core/rmem_default
[ -f /proc/sys/net/core/rmem_max ] && echo 262144 > /proc/sys/net/core/rmem_max
[ -f /proc/sys/net/core/wmem_default ] && echo 262144 > /proc/sys/net/core/wmem_default
[ -f /proc/sys/net/core/wmem_max ] && echo 262144 > /proc/sys/net/core/wmem_max
[ -f /proc/sys/net/ipv4/tcp_rmem ] && echo 4096 87380 8388608 > /proc/sys/net/ipv4/tcp_rmem
[ -f /proc/sys/net/ipv4/tcp_wmem ] && echo 4096 65536 8388608 > /proc/sys/net/ipv4/tcp_wmem
[ -f /proc/sys/net/ipv4/ip_local_port_range ] && echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range